<template>
    <view class="container data-v-9e1fa7ba">
        <view class="title data-v-9e1fa7ba">
            <view class="title-bg data-v-9e1fa7ba"></view>
            请选择套餐
        </view>
        <view class="list data-v-9e1fa7ba">
            <view
                @tap="__e"
                class="item data-v-9e1fa7ba"
                :data-event-opts="[['tap', [['submitBuy', ['$0'], [[['list', '', index]]]]]]]"
                hoverClass="hover"
                v-for="(item, index) in list"
                :key="index"
            >
                <view class="score data-v-9e1fa7ba">
                    {{ '' + item.score }}
                    <label class="score-text _span data-v-9e1fa7ba">{{ scoreAlias }}</label>
                </view>

                <view class="money data-v-9e1fa7ba">
                    {{ '售价: ' + item.money_price / 100 }}
                    <label class="money-text _span data-v-9e1fa7ba">元</label>
                </view>
            </view>
        </view>
        <block v-if="setting.rule">
            <view class="title data-v-9e1fa7ba">充值说明</view>
            <view class="rule-list data-v-9e1fa7ba">
                <view class="item data-v-9e1fa7ba" v-for="(item, index) in setting.rule" :key="index">{{ index + 1 + '、' + item }}</view>
            </view>
        </block>
        <view class="zhuyi data-v-9e1fa7ba">
            <text class="data-v-9e1fa7ba">注意：充值不能退款,不能提现</text>
        </view>
        <no-data @__l="__l" class="data-v-9e1fa7ba" vueId="23fe0cb2-1" v-if="$root.g0"></no-data>
    </view>
</template>

<script>
import noData from '@/components/NoData/NoData';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/myScore/buy'],
    {
        '233b': function (t, e, n) {},
        '42f0': function (t, e, n) {
            'use strict';

            (function (t, e) {
                var r = n('4ea4');
                n('18ba');
                r(n('66fd'));
                var o = r(n('a5cd'));
                t.__webpack_require_UNI_MP_PLUGIN__ = n;
                e(o.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        },
        '505d': function (t, e, n) {
            'use strict';

            (function (t) {
                var r = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var o = r(n('2eee'));
                var i = r(n('9523'));
                var a = r(n('c973'));
                var c = r(n('82c0'));
                function s(t, e) {
                    var n = Object.keys(t);
                    if (Object.getOwnPropertySymbols) {
                        var r = Object.getOwnPropertySymbols(t);
                        if (e) {
                            r = r.filter(function (e) {
                                return Object.getOwnPropertyDescriptor(t, e).enumerable;
                            });
                        }
                        n.push.apply(n, r);
                    }
                    return n;
                }
                function u(t) {
                    for (var e = 1; e < arguments.length; e++) {
                        if (null != arguments[e]) {
                            var n = arguments[e];
                        } else {
                            var n = {};
                        }
                        if (e % 2) {
                            s(Object(n), true).forEach(function (e) {
                                (0, i.default)(t, e, n[e]);
                            });
                        } else {
                            Object.getOwnPropertyDescriptors
                                ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n))
                                : s(Object(n)).forEach(function (e) {
                                      Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
                                  });
                        }
                    }
                    return t;
                }
                var f = {
                    components: {},
                    data: function () {
                        return {
                            isInit: false,
                            list: [],
                            setting: {}
                        };
                    },
                    computed: {
                        userInfo: function () {
                            return this.$store.getters.userInfo;
                        }
                    },
                    onLoad: function () {
                        var that = this;
                        return (0, a.default)(
                            o.default.mark(function n() {
                                return o.default.wrap(function (n) {
                                    for (;;) {
                                        switch ((n.prev = n.next)) {
                                            case 0:
                                                that.$store.dispatch('getUserInfo');
                                                t.showLoading({
                                                    title: '加载中'
                                                });
                                                that.$http('/asset/score-skus').then(function (n) {
                                                    that.list = n.data.list;
                                                    that.setting = n.data.setting;
                                                    that.isInit = true;
                                                    t.hideLoading();
                                                });
                                            case 3:
                                            case 'end':
                                                return n.stop();
                                        }
                                    }
                                }, n);
                            })
                        )();
                    },
                    methods: {
                        submitBuy: function (e) {
                            var that = this;
                            t.showLoading({
                                title: '请求中'
                            });
                            this.$http('/asset/score-order/confirm', 'POST', {
                                sku_id: e.id
                            }).then(function (e) {
                                t.hideLoading();
                                var r = e.data;
                                r.is_need_pay
                                    ? c.default.pay(
                                          u(
                                              u({}, r),
                                              {},
                                              {
                                                  success: function () {
                                                      t.showToast({
                                                          title: '充值成功，即将跳转~',
                                                          icon: 'none'
                                                      });
                                                      setTimeout(function (e) {
                                                          t.redirectTo({
                                                              url: '/pages/myScore/index'
                                                          });
                                                      }, 1500);
                                                  },
                                                  fail: function () {
                                                      t.showToast({
                                                          title: '支付失败',
                                                          icon: 'none'
                                                      });
                                                      that.$http('/orders/'.concat(r.order.uuid), 'PUT', {
                                                          type: 'close_and_delete'
                                                      });
                                                  }
                                              }
                                          )
                                      )
                                    : (t.showToast({
                                          title: '充值成功，即将跳转~',
                                          icon: 'none'
                                      }),
                                      setTimeout(function (e) {
                                          t.navigateTo({
                                              url: '/pages/myScore/index'
                                          });
                                      }, 1500));
                            });
                        }
                    }
                };
                e.default = f;
            }.call(this, n('543d').default));
        },
        '65f5': function (t, e, n) {
            'use strict';

            n.r(e);
            var r = n('505d');
            var o = n.n(r);
            for (var i in r) {
                if (['default'].indexOf(i) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return r[t];
                        });
                    })(i);
                }
            }
            e.default = o.a;
        },
        '8d7d': function (t, e, n) {
            'use strict';

            var r = n('233b');
            n.n(r).a;
        },
        a5cd: function (t, e, n) {
            'use strict';

            n.r(e);
            var r = n('a9d3');
            var o = n('65f5');
            for (var i in o) {
                if (['default'].indexOf(i) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return o[t];
                        });
                    })(i);
                }
            }
            n('8d7d');
            var a = n('f0c5');
            var c = Object(a.a)(o.default, r.b, r.c, false, null, '9e1fa7ba', null, false, r.a, void 0);
            e.default = c.exports;
        },
        a9d3: function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return o;
            });
            n.d(e, 'c', function () {
                return i;
            });
            n.d(e, 'a', function () {
                return r;
            });
            var r = {
                NoData: function () {
                    return n.e('components/NoData/NoData').then(n.bind(null, 'cafe'));
                }
            };
            var o = function () {
                this.$createElement;
                var t = (this._self._c, !this.list.length && this.isInit);
                this.setData(
                    Object.assign(
                        {},
                        {
                            $root: {
                                g0: t
                            }
                        }
                    )
                );
            };
            var i = [];
        }
    },
    [['42f0', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './buy.css';
</style>
